﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using HZ.Supervise.Model;
using HZ.Supervise.Model.Enum;

namespace HZ.Supervise.Web.Secondphase
{
    public partial class ComplainList : BasePage
    {

        public ComplainList()
        {
            this.ModuleNo = Module.意见反馈.ToString();
            this.PageOperateType = OperateType.意见信息.ToString();
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            BindList();
        }
        void BindList()
        {
            HZ.Supervise.IBLL.IBLL_PreWarning pre = HZ.Supervise.BLLFactory.IBLL_PreWarning();

            HZ.Supervise.Model.Complain complain = new HZ.Supervise.Model.Complain();

			if (CurrentAccount.GetUser().UserID != "root")
			{

				complain.UserId = CurrentAccount.GetUser().UserID;

			}

            if (!string.IsNullOrEmpty(this.txtComPlainDate.Text))
            {
                complain.ComplainTime = txtComPlainDate.Text.Trim();
            }
            else
            {
                complain.ComplainTime = "1900-2-2";
            }
            if (!string.IsNullOrEmpty(this.txtcomplainantName.Text))
            {
                complain.ComplainantName = this.txtcomplainantName.Text.Trim();
            }
            //if (!string.IsNullOrEmpty(this.txtDealDate.Text))
            //{
            //    complain.ReplyTime = this.txtDealDate.Text.Trim();
            //}
            //else
            //{
            //    complain.ReplyTime = "1900-2-2";
            //}
            //if (ddlIsDeal.SelectedValue.ToString() == "3")
            //{
            //    complain.Status = 3;
            //}
            //else
            //{
            //    complain.Status = int.Parse(ddlIsDeal.SelectedValue.ToString());
            //}
            int t = 0;

            System.Data.DataTable dt = new System.Data.DataTable();
            
            dt = pre.GetComplain(complain, this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize , out t);

            AspNetPager1.RecordCount = t;

            gvwComplain.DataSource = dt;
            gvwComplain.DataBind();
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            //BindList();
        }
        /// <summary>
        /// 分页
        /// by张雄
        /// </summary>
        /// <param name="sender">事件发送源</param>
        /// <param name="e">事件参数</param>
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindList();
        }
    }
}
